package com.ysalliance.getFan.organization.ui.task;

import android.content.Intent;
import android.text.InputFilter;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.blankj.utilcode.util.Utils;
import com.google.gson.Gson;
import com.ysalliance.getFan.organization.Bean.ClassBean;
import com.ysalliance.getFan.organization.Bean.OrganizationBean;
import com.ysalliance.getFan.organization.Bean.TaskBean;
import com.ysalliance.getFan.organization.Bean.bus.ChangeClassNameBean;
import com.ysalliance.getFan.organization.LucasUtil;
import com.ysalliance.getFan.organization.R;
import com.ysalliance.getFan.organization.network.Network;
import com.ysalliance.getFan.organization.ui.EnterCreateClassSuccessActivity;
import com.ysalliance.getFan.organization.ui.base.LucasBaseActivity;

import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;

import androidx.annotation.NonNull;
import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;

import static com.ysalliance.getFan.organization.FanerConstant.CHANGE_CLASS_NAME;
import static com.ysalliance.getFan.organization.FanerConstant.SET_CLASS_NAME;
import static com.ysalliance.getFan.organization.FanerConstant.SET_TASK_NAME;


/**
 * EditText   修改任务名
 * @author lucas
 * created at 2020-02-24 14:54
 */
public class UpdateTaskEditActivity extends LucasBaseActivity {

    //用户协议
    @BindView(R.id.tv_title)
    TextView tv_title;
    @BindView(R.id.tv_create_class)
    TextView tv_create_class;
    @BindView(R.id.et_content)
    EditText et_content;


    private TaskBean taskBean;

    @Override
    public int bindContentView() {
        return R.layout.activity_enter_create_class;
    }

    @Override
    public void afterView() {
        super.afterView();

        taskBean = (TaskBean)getIntent().getSerializableExtra("task");


        tv_title.setText("修改任务名");
        et_content.setFilters(new InputFilter[]{new InputFilter.LengthFilter(100)});
        et_content.setText(taskBean.getName());





        initClick();

    }


    public void initClick() {
        //完成按钮的点击事件
        tv_create_class.setOnClickListener(v->{
            String class_name = et_content.getText().toString().trim();
            if(class_name.length()>0){
                Intent intent = new Intent();
                intent.putExtra("task_name", class_name);
                setResult(RESULT_OK, intent);
                finish();
            }else {
                ToastUtils.showShort("请输入");
            }



        });



    }









}
